<!--

//Keeps other sites from opening this page in their frame
  if ( window.parent != window.self ) {
	window.open(document.location,'_top');
  }


//updated validation: Marc Thompson
var submitted_form = "0";

function submit_login(){
	var form = document.login_form;
	var message = new Array("Please provide your uNID.","The uNID provided is not valid.","Please provide your uNID password.","The password provided is not valid.");
	var alertText="";
	var logonVal = form.logon.value;
	var pswdVal = form.password.value;
	var RegEx = /^u\d{7}/  //must start with "u" followed by exactly 7 digits [0-9]

    if (submitted_form == "1") {
        return false;
    }
	if (logonVal == "") {
		alertText = "\n"+message[0];
    }else if (logonVal.search(RegEx) == -1) {
		alertText = "\n"+message[1];
    }
	if (pswdVal == "") {
		alertText += "\n"+message[2];
    }else if (pswdVal.length < 5) {
		alertText += "\n"+message[3];
    }

	if(alertText){
		alert(alertText);
		return false;
	}else{
        submitted_form = "1";
		return true;
    }
}
//Make sure someone else doesn't get the password on reload
//form submission script by John Desha
function enter_key_trap(e)
{
	var form = document.login_form;
    var keyPressed;
    if (document.layers) {
        keyPressed = String.fromCharCode(e.which);
    } else if (document.all) {
        keyPressed = String.fromCharCode(window.event.keyCode);
    } else if (document.getElementById) {
        keyPressed = String.fromCharCode(e.keyCode);
    }
	
    if ((keyPressed == "\r" || keyPressed == "\n") && (submit_login())) {
        form.submit();
        form.logon.value='';
        form.password.value='';
    }
}

// -->